package com.family.mapper;

import com.family.model.Generation;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface GenerationMapper {
    /**
     * 通过姓对应的id获取字辈
     *
     * @param nameId
     * @return
     */
    List<Generation> queryGenerationsByNameId(int nameId);

    /**
     * 添加字辈
     *
     * @param generation
     * @return
     */
    int addGeneration(Generation generation);

    /**
     * 查询字辈
     *
     * @param generationId
     * @return
     */
    Generation queryGenerationById(int generationId);


    /**
     * 通过姓、字辈名查询字辈(generation.nameId,generation.value)
     *
     * @return
     */
    Generation queryGenerationByName(Generation generation);

    /**
     * 查询所有父id为parentGenerationId的字辈
     *
     * @param parentGenerationId
     * @return
     */
    List<Generation> queryGenerationsByParentId(int parentGenerationId);

    /**
     * 更新字辈
     *
     * @param generations
     * @return
     */
    void updateGenerations(@Param("generations") List<Generation> generations);


    /**
     * 删除字辈
     *
     * @param generationId
     */
    void deleteGenerationById(int generationId);
}
